package com.hee.erp.hidden;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

public class CodeGenerator2 {

    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://rm-2zec52h2zowfmrw5vjo.mysql.rds.aliyuncs.com:3306/ggxq-product?useUnicode=yes&characterEncoding=UTF-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai",
                        "ggxq", "ggxq_2022")
                .globalConfig(builder -> {
                    builder.author("weizehong") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .outputDir(System.getProperty("user.dir") + "\\generationCode2\\"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.ggxq.product") // 设置父包名
                            .xml("mapper")
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir") + "\\generationCode2\\src\\main\\resources\\mapper\\")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude("pms_brand") // 设置需要生成的表名
                            .addTablePrefix("") // 设置过滤表前缀
                            .entityBuilder()
                            .enableLombok()
                            .enableTableFieldAnnotation()
                            .controllerBuilder()
                            .enableRestStyle()
                            .mapperBuilder()
                            .superClass(BaseMapper.class);

                })
                //.templateEngine(null) // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .execute();

    }

}
